import Vue from 'vue'
import VueRouter from 'vue-router'

import User_login from '@/views/User_login'
import Pat_reg from '@/views/Pat_reg'
import Doc_reg from '@/views/Doc_reg'

import Admin_home from '@/views/admin/Admin_home'
import Admin_allPatient from '@/views/admin/Admin_allPatient'
import Admin_info from '@/views/admin/Admin_info'
import Admin_patLabel from '@/views/admin/Admin_patLabel'
import Admin_patLabelCount from '@/views/admin/Admin_patLabelCount'
import Admin_service from '@/views/admin/Admin_service'
import Admin_signDoctor from '@/views/admin/Admin_signDoctor'
import Admin_signHospital from '@/views/admin/Admin_signHospital'
import Admin_signPatient from '@/views/admin/Admin_signPatient'
import Admin_signRecord from '@/views/admin/Admin_signRecord'
import Admin_signTeam from '@/views/admin/Admin_signTeam'
import Admin_waitThing from '@/views/admin/Admin_waitThing'

import Doc_healthCheck from '@/views/doctor/Doc_healthCheck'
import Doc_healthRecord from '@/views/doctor/Doc_healthRecord'
import Doc_home from '@/views/doctor/Doc_home'
import Doc_info from '@/views/doctor/Doc_info'
import Doc_service from '@/views/doctor/Doc_service'
import Doc_signPakage from '@/views/doctor/Doc_signPakage'
import Doc_signPatient from '@/views/doctor/Doc_signPatient'
import Doc_signRecord from '@/views/doctor/Doc_signRecord'
import Doc_signTeam from '@/views/doctor/Doc_signTeam'
import Doc_message from '@/views/doctor/Doc_message'
import Doc_Chat from '@/views/doctor/Doc_Chat'

import Pat_family from '@/views/patient/Pat_family'
import Pat_healthCheck from '@/views/patient/Pat_healthCheck'
import Pat_healthRecord from '@/views/patient/Pat_healthRecord'
import Pat_home from '@/views/patient/Pat_home'
import Pat_info from '@/views/patient/Pat_info'
import Pat_message from '@/views/patient/Pat_message'
import Pat_myDoctor from '@/views/patient/Pat_myDoctor'
import Pat_myPackage from '@/views/patient/Pat_myPackage'
import Pat_sign from '@/views/patient/Pat_sign'
import Pat_signRecord from '@/views/patient/Pat_signRecord' 
import Pat_signTeam from '@/views/patient/Pat_signTeam'
import Pat_selDoc from '@/views/patient/Pat_selDoc'
import Pat_appointment from '@/views/patient/Pat_appointment'
import Pat_appointmentRecord from '@/views/patient/Pat_appointmentRecord'

Vue.use(VueRouter)

const routes = [

  {path:"/",redirect:"/User_login"},
  {path:"/User_login",component:User_login},
  {path:"/Pat_reg",component:Pat_reg},
  {path:"/Doc_reg",component:Doc_reg},

  {path:"/Pat_home",component:Pat_home,
    children: [
      { path: "/Pat_signRecord", component: Pat_signRecord },
      { path: "/Pat_sign", component: Pat_sign },
      { path: "/Pat_myPackage", component: Pat_myPackage },
      { path: "/Pat_myDoctor", component: Pat_myDoctor },
      { path: "/Pat_message", component: Pat_message },
      { path: "/Pat_info", component: Pat_info },
      { path: "/Pat_healthRecord", component: Pat_healthRecord },
      { path: "/Pat_healthCheck", component: Pat_healthCheck},
      { path: "/Pat_family", component: Pat_family },
      { path: "/Pat_signTeam", component: Pat_signTeam },
      { path: "/Pat_selDoc", component: Pat_selDoc },
      { path: "/Pat_appointment", component: Pat_appointment },
      { path: "/Pat_appointmentRecord", component: Pat_appointmentRecord },
    ]
  },
  {
    path: "/Doc_home", component: Doc_home,
    children: [
      { path: "/Doc_healthRecord", component: Doc_healthRecord },
      { path: "/Doc_info", component: Doc_info},
      { path: "/Doc_healthCheck", component: Doc_healthCheck },
      { path: "/Doc_service", component: Doc_service },
      { path: "/Doc_signPakage", component: Doc_signPakage },
      { path: "/Doc_signPatient", component: Doc_signPatient },
      { path: "/Doc_signRecord", component: Doc_signRecord },
      { path: "/Doc_signTeam", component: Doc_signTeam },
      { path: "/Doc_message", component: Doc_message },
      { path: "/Doc_Chat", component: Doc_Chat }
    ]
  },
  {
    path: "/Admin_home", component: Admin_home,
    children: [
      {path: "/Admin_allPatient",component:Admin_allPatient},
      {path:"/Admin_info",component:Admin_info},
      {path:"/Admin_patLabel",component:Admin_patLabel},
      {path: "/Admin_patLabelCount",component:Admin_patLabelCount},
      {path:"/Admin_service",component:Admin_service},
      {path:"/Admin_signDoctor",component:Admin_signDoctor},
      {path:"/Admin_signHospital",component:Admin_signHospital},
      {path: "/Admin_signPatient",component:Admin_signPatient},
      {path:"/Admin_signRecord",component:Admin_signRecord},
      {path:"/Admin_signTeam",component:Admin_signTeam},
      {path:"/Admin_waitThing",component:Admin_waitThing}
    ]
  }
]

const router = new VueRouter({
  routes
})

//路由守卫
// router.beforeEach((to, from, next) => {
//    if(to.path == "/User_login") {
//    next();
//    return;
//    }
  
//    let token = sessionStorage.getItem("token");
//    if(token == null) {
//     router.push("/User_login");
//     return;
//    }
//    next();
//   });

export default router
